﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xml.Linq;
using CSharpToolWPF.Pages;
using Windows.Devices.Enumeration;
using Windows.UI.Composition;

namespace CSharpToolWPF {
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
            this.Loaded += MainWindow_Loaded;
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e) {
            AutoAddDenpendencies_Click(sender, e);


        }

        private void AddProjectToNewSln_Click(object sender, RoutedEventArgs e) {
            MainFrame.Navigate((Application.Current as App)?.serviceProvider.GetService(typeof(PageAddProjectToNewSln)));
        }

        private void AutoAddDenpendencies_Click(object sender, RoutedEventArgs e) {
            MainFrame.Navigate((Application.Current as App)?.serviceProvider.GetService(typeof(PageAutoAddDenpendencies)));
        }

        private void Test_Click(object sender, RoutedEventArgs e) {
            MainFrame.Navigate((Application.Current as App)?.serviceProvider.GetService(typeof(PageTest)));
        }

        //private void NavigationTop_PaneClosed(Wpf.Ui.Controls.NavigationView sender, RoutedEventArgs args) {
        //    // 创建一个DoubleAnimation动画，从当前宽度到目标宽度
        //    var animation = new DoubleAnimation {
        //        From = NavigationTop.Width,  // 起始宽度
        //        To = 45,         // 目标宽度
        //        Duration = new Duration(TimeSpan.FromSeconds(0.2)),  // 动画持续时间
        //        EasingFunction = new QuadraticEase()  // 可选：添加缓动函数，使动画更平滑
        //    };
        //    NavigationTop.BeginAnimation(FrameworkElement.WidthProperty, animation);
        //}

        //private void NavigationTop_PaneOpened(Wpf.Ui.Controls.NavigationView sender, RoutedEventArgs args) {
        //    // 创建一个DoubleAnimation动画，从当前宽度到目标宽度
        //    var animation = new DoubleAnimation {
        //        From = NavigationTop.Width,  // 起始宽度
        //        To = 200,         // 目标宽度
        //        Duration = new Duration(TimeSpan.FromSeconds(0.2)),  // 动画持续时间
        //        EasingFunction = new QuadraticEase{EasingMode = EasingMode.EaseIn}  // 可选：添加缓动函数，使动画更平滑
        //    };

        //    NavigationTop.BeginAnimation(FrameworkElement.WidthProperty, animation);
        //}

        private void PageCheckNotAddedProjects_Click(object sender, RoutedEventArgs e) {
            MainFrame.Navigate((Application.Current as App)?.serviceProvider.GetService(typeof(PageCheckNotAddedProjects)));
        }

        private void Window_Closed(object sender, EventArgs e) {
            Application.Current.Shutdown();
        }
    }
}